package mysql

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Account  string `gorm:"type:varchar(20);not null;commit:'账号'"`
	Password string `gorm:"type:varchar(20);not null;commit:'密码'"`
}
type Note struct {
	gorm.Model
	UserId  int    `gorm:"type:int"`
	Title   string `gorm:"type:varchar(20);not null;"`
	Context string `gorm:"type:varchar(20);not null;"`
}
type Video struct {
	gorm.Model
	Name    string `gorm:"type:varchar(20);not null;"`
	Address string `gorm:"type:varchar(20);not null;"`
	Text    string `gorm:"type:varchar(20);not null;"`
}
type Like struct {
	gorm.Model
	UserId int `gorm:"type:int"`
	Video  int `gorm:"type:int"`
}
type AuthRealName struct {
	gorm.Model
	UserId int    `gorm:"type:int"`
	Name   string `gorm:"type:varchar(20);not null;commit:'名称'"`
	IdCard string `gorm:"type:varchar(50);not null;commit:'身份证号'"`
}

func (r *AuthRealName) RealNameList() error {
	return DB.Debug().Where("userId=?", r.UserId).Limit(1).Find(&r).Error
}
func (r *AuthRealName) RealNameAdd() error {
	return DB.Debug().Create(&r).Error
}
